<script setup>
import { ref } from 'vue';

const emit = defineEmits(['closeModal'])

const isModify = ref(false)


function changeIsModify() {
    isModify.value = !isModify.value
}

function cancel() {
    emit('closeModal')
}

function confirm() {
    emit('closeModal')

}

</script>

<template>
    <div class="account-form">
        <div class="form">
            <p><span>邮箱号</span><input type="text" :class="{edit: isModify}" /></p>
            <p><span>手机号</span><input type="text" :class="{edit: isModify}" /></p>
            <p><span>旧密码</span><input type="password" :class="{edit: isModify}" /></p>
            <p><span>新密码</span><input type="password" :class="{edit: isModify}" /></p>
        </div>
        <div class="btns" >
            <button type="button" @click="cancel" class="cancel" >取消</button>
            <button type="button" @click="confirm" >确定</button>
        </div>
        <div class="footer" >
            <span v-show="!isModify" @click="changeIsModify" >修改</span>
            <span v-show="isModify" @click="changeIsModify" >返回</span>
        </div>
    </div>

</template>
<style scoped>

.account-form >.form {
    display: flex;

    align-items: center;

    flex-direction: column;
    padding: 50px 50px
}

.account-form >.form>p {
    margin-bottom: 20px;
    height: 40px;
}

.account-form >.form>p>span {
    display: inline-block;
    height: 36px;
    font-family: Source Han Sans CN;
	font-size: 22px;
	line-height: 36px;
	color: #707070;
}

.account-form >.form>p>span::after {
    content: ': '
}

.account-form >.form>p>input[type=text], .account-form >.form>p>input[type=password] {
    width: 400px;
    padding: 9px 17px 11px 17px;
    /* margin: 5px 0 5px 0; */
    display: none;
    border: none;
    background-color: #f1f2f6;
    border-radius: 10px;
    height: 36px;
    font-size: 16px;
    font-family: Source Han Sans CN;
}

.account-form >.form>p>input[type=text].edit, .account-form >.form>p>input[type=password].edit {
    display: inline-block;
}

.account-form >.form>p>input[type=text]::placeholder,
.account-form >.form>p>input[type=password]::placeholder {
    font-size: 16px;
    font-family: Source Han Sans CN;
    color: #707070;
    opacity: 0.7;
}

.account-form >.form>p>input[type=text]:focus,
.account-form >.form>p>input[type=password]:focus {
    background-color: #ddd;
    outline: none;
}

.account-form>.btns {
    display: flex;
    justify-content: space-around;
    align-items: center;

}

.account-form>.btns>button {
    width: 162px;
    height: 40px;
    background-color: #8493a6;
    box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.16);
    border-radius: 10px;
    color: #ffffff;
    font-family: Source Han Sans CN;
    font-size: 18px;
    line-height: 40px;
    color: #fafafa;
    border: none;
    user-select: none;
    cursor: pointer;
}

.account-form>.btns>button:hover {
    opacity: 0.85;
}

.account-form>.btns>button:active {
    transform: translateY(3px);
}

.account-form>.btns>button.cancel {
    background-color: #939393;
}


.account-form >.footer {
    width: 90%;
    display: flex;
    justify-content: end;
    align-items: center;
    margin-top: 66px;
}

.account-form >.footer>span {
    display: inline-block;
    font-family: Source Han Sans CN;
	font-size: 20px;
	line-height: 20px;
	color: #8493a6;
    cursor: pointer;
    text-decoration: underline;
    user-select: none;
}

.account-form >.footer>span:hover {
    color: #226ccd;
}


</style>